from flask import Flask
from sentence_transformers import SentenceTransformer
from elasticsearch import Elasticsearch

app = Flask(__name__)
app.config["SECRET_KEY"] = "123456" # 密钥随意，用于表单

# 加载模型
# img_model = SentenceTransformer('clip-ViT-B-32')
img_model = SentenceTransformer('/Users/lrk/.cache/huggingface/hub/clip-ViT-B-32')  # 加载本地库

# 创建 es 连接
es = Elasticsearch('https://elastic:123456@localhost:9200', ca_certs='./certs/ca.crt', verify_certs=True, request_timeout=3600)

from app import routes

if __name__ == "__main__":
    # app.run(host="0.0.0.0", debug=True, port=5001)
    app.run(host="0.0.0.0", debug=True)